package com.byfan.barter.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @Author: FBY
 * @Description
 * @Version 1.0
 * @Date: 2021/5/14 14:31
 */
@Entity
@Data
@EntityListeners(AuditingEntityListener.class)
@ApiModel
@Table(name = "commodity")
public class Commodity implements Serializable {

    /**
     * 商品唯一id
     */
    @ApiModelProperty(value = "商品id（新增时不传参，修改商品时要传参）")
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name = "id")
    private int id;

    /**
     * 商品标题
     */
    @ApiModelProperty(value = "商品标题")
    @Column(name = "title")
    private String title;

    /**
     * 商品描述
     */
    @ApiModelProperty(value = "商品描述")
    @Column(name = "description")
    private String description;

    /**
     * 发布者openid
     */
    @ApiModelProperty(value = "用户的openId")
    @Column(name = "openid")
    private String openId;
    /**
     * 商品图片1
     */
    @ApiModelProperty(value = "图片1的文件名")
    @Column(name = "img_1")
    private String img1;
    /**
     * 商品图片2
     */
    @ApiModelProperty(value = "图片2的文件名")
    @Column(name = "img_2")
    private String img2;
    /**
     * 商品图片3
     */
    @ApiModelProperty(value = "图片3的文件名")
    @Column(name = "img_3")
    private String img3;
    /**
     * 发布者昵称
     */

    @ApiModelProperty(value = "发布者昵称")
    @Column(name = "nick_name")
    private String nickName;

    /**
     * 地址：省/市/区/街道
     */
    @ApiModelProperty(value = "发布地区（省/市/区/街道）")
    @Column(name = "address")
    private String address;

//    /**
//     * 地址-省份
//     */
//    @Column(name = "address_province")
//    private String addressProvince;
//    /**
//     * 地址-城市
//     */
//    @Column(name = "address_city")
//    private String addressCity;
//    /**
//     * 地址-市区
//     */
//    @Column(name = "address_region")
//    private String addressRegion;
//    /**
//     * 地址-街道
//     */
//    @Column(name = "address_street")
//    private String addressStreet;
    /**
     * 学校
     */
    @ApiModelProperty(value = "发布者学校")
    @Column(name = "school")
    private String school;
    /**
     * 商品分类
     */
    @ApiModelProperty(value = "商品类别")
    @Column(name = "classify")
    private String classify;
    /**
     * 商品状态
     */
    @ApiModelProperty(value = "商品状态")
    @Column(name = "status")
    private String status;
    /**
     * 创建时间
     */
    @ApiModelProperty(value = "商品发布时间（任何请求都不用传参）")
    @CreatedDate
    @Column(name = "creat_time")
    private Date creatTime;
    /**
     * 最后修改时间
     */
    @ApiModelProperty(value = "商品修改时间（任何请求都不用传参）")
    @LastModifiedDate
    @Column(name = "update_time")
    private Date updateTime;





}
